import { cloneDeep } from 'lodash';

export const transferSchema = (schema = {}) => {
  const newSchema = cloneDeep(schema);
  // 移除initialValue
  Object.entries(newSchema).forEach(([, value]: [string, any]) => {
    const options = value.options || {};
    delete options.initialValue;
  });
  const finallSchema = {
    type: 'object',
    propertyType: {
      ...newSchema,
    },
  };
  return finallSchema;
};
